package com.engine4cloud.tdf.education.convert;

import com.engine4cloud.tdf.education.dto.create.PsychologicalCounsellingAttendCreateDTO;
import com.engine4cloud.tdf.education.dto.result.PsychologicalCounsellingAttendResultDTO;
import com.engine4cloud.tdf.education.dto.update.PsychologicalCounsellingAttendUpdateDTO;
import com.engine4cloud.tdf.education.entity.PsychologicalCounsellingAttendEntity;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;


@Mapper
public interface PsychologicalCounsellingAttendConvert {
    PsychologicalCounsellingAttendConvert INSTANCE = Mappers.getMapper(PsychologicalCounsellingAttendConvert.class);

    @Mapping(target = "id", ignore = true)
    PsychologicalCounsellingAttendEntity createTo(PsychologicalCounsellingAttendCreateDTO s);

    PsychologicalCounsellingAttendEntity update(PsychologicalCounsellingAttendUpdateDTO s);

    PsychologicalCounsellingAttendResultDTO convert(PsychologicalCounsellingAttendEntity s);

    default PsychologicalCounsellingAttendEntity create(String code, PsychologicalCounsellingAttendCreateDTO s, Long tenantId) {
        PsychologicalCounsellingAttendEntity entity = createTo(s);
        entity.setFdbh(code);
        entity.setTenantId(tenantId);
        return entity;
    }
}
